// chrome.contextMenus.create({
//   id: 'patchData',
//   title: '爬取数据',
//   contexts: ['all']
// })

// chrome.contextMenus.onClicked.addListener((info, tab) => {
//   sendMsgToContent2('test')
// })

// // 监听信息接受
// chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
//   const { from, to, action, data } = request
//   if (to == 'service-worker' && from == 'content') {
//     console.log(` ==>`, { action, data })
//   }
// })

// const sendMsgToContent2 = (action: string, data?: any) => {
//   chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) {
//     chrome.tabs.sendMessage(tabs[0].id as number, {
//       from: 'service-worker',
//       to: 'content',
//       action,
//       data
//     })
//   })
// }
// chrome.devtools.network.onRequestFinished.addListener(function (request) {
//   console.log(request)
// })

// chrome.webRequest.onBeforeSendHeaders.addListener(
//   detail => {
//     console.log(`detail ==>`, JSON.parse(JSON.stringify(detail)))
//   },
//   {
//     urls: ['<all_urls>']
//   },
//   ['requestHeaders']
// )
